package collections;

import java.util.*;
import java.util.function.BiConsumer;

public class Test4 {
    public static void main(String[] args) {
        //创建map集合
        Map<String, ArrayList<String>> map = new HashMap<>();

        //创建arraylist集合
        ArrayList<String> city1 = new ArrayList<>();
        Collections.addAll(city1,"南京市","扬州市","苏州市","无锡市","常州市");
        ArrayList<String> city2 = new ArrayList<>();
        Collections.addAll(city2,"武汉市","孝感市","十堰市","宜昌市","鄂州市");
        ArrayList<String> city3 = new ArrayList<>();
        Collections.addAll(city3,"石家庄市","唐山市","邢台市","保定市","张家口市");

        //存入map
        map.put("江苏省",city1);
        map.put("湖北省",city2);
        map.put("河北省",city3);

        map.forEach((s, city) -> {
                StringJoiner stringJoiner = new StringJoiner(", ","","");
                for (int i = 0; i < city.size(); i++) {
                    stringJoiner.add(city.get(i));
                }
                System.out.println(s + " = " + stringJoiner);
            }
        );

    }
}
